package com.hotel.dao;

import com.hotel.pojo.Check;
import com.hotel.pojo.User;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface CheckMapper {


    void addCheck(Check check);

    void deleteCheckById(Integer id);

    List<Check> queryAllChecks();

    Check queryCheckById(Integer id);

    void updateCheckById(Check check);

    @Select("select a.id,a.name,a.code,a.phone,a.address,a.room_id,a.status" +
            " from Customers as a  inner join home as b on a.room_id=b.id where b.num=#{roomNumber}")
    Check queryCheckByRoomNumber(String roomNumber);

    @Update("update Customers set status='已结算',checkOutTime=#{checkOutTime} where id=#{id}")
    void updateStatusById(Check check);

    @Select("select * from Customers where status='已结算'")
    List<Check> queryAll();
}
